package com.lefevre.cms.controller;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.lefevre.cms.common.ApiResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "格言，数据来源‘一言API’")
@RestController
@RequestMapping("/motto")
public class MottoController {

    @GetMapping()
    public ApiResult<Object> getMotto() {
        String result2 = HttpUtil.get("https://v1.hitokoto.cn/", CharsetUtil.CHARSET_UTF_8);
        Object o = JSON.parseObject(result2);
        return ApiResult.success(o);
    }
}
